/**
* Copyright (c) By zengqh.
*
* This program is just for fun or demo, in the hope that it  
* will be useful, you can redistribute it and/or modify freely.
*
* Time: 2013/03/15
* File: Geometry.cpp
* Blog: http://www.cnblogs.com/zengqh/
**/

#include "Geometry.h"
namespace HY
{
Geometry::Geometry()
: flags_(0)
, active_(true)
, prim_type_(0)
, mat_idx_(0)
, start_idx_(0)
, idx_size_(0)
{

}

Geometry::~Geometry()
{

}

const std::string& Geometry::getName() const
{
	return name_;
}

void Geometry::setName(const std::string& name = "")
{
	name_ = name;
}

uint32 Geometry::getFlags() const
{
	return flags_;
}

void Geometry::setFlags(uint32 flags = 0)
{
	flags_ = flags;
}

bool Geometry::isActive() const
{
	return active_;
}

void Geometry::setActive(bool active = true)
{
	active_ = active;
}

uint32 Geometry::getPrimitiveType() const
{ 
	return prim_type_;	
}

void Geometry::setPrimitiveType(uint32 prim)
{
	prim_type_ = prim;
}

uint32 Geometry::getMaterial() const
{
	return mat_idx_;
}

void Geometry::setMaterial(uint32 nMat = 0)
{
	mat_idx_ = nMat;
}

uint32 Geometry::getStartIdx() const
{
	return start_idx_;
}

void Geometry::setStartIdx(uint32 start_idx = 0)
{
	start_idx_ = start_idx;
}

uint32 Geometry::getIdxSize() const
{
	return idx_size_;
}

void Geometry::setIdxSize(uint32 idx_size = 0)
{
	idx_size_ = idx_size;
}

uint32 Geometry::getNumOfTriangles() const
{
	if (idx_size_ > 2)
	{
		switch (prim_type_)
		{
		case Primitive::TriangleList:
			return idx_size_ / 3;
		default:
			break;
		}
	}

	HY_ASSERT(0);
	return 0;
}

}